package com.dbh.design.proxy.jdk;

import java.lang.reflect.Method;

/**
 * @author dongbanghui
 * @create 2023/4/9
 */
public class Main {

    public static void main(String[] param) {

        Foo foo = new $Proxy0((Object proxy, Method method, Object[] args) -> {
            // 1.增强逻辑
            System.out.println("before...");
            // 2.调用目标
//            new Target().foo();
            Object result = method.invoke(new Target(), args);
            return result;
        });
        foo.foo();
        foo.bar();

    }

}
